<template>
  <div>
    <div class="page_tab_top">
      <div
        class="tab_list_item"
        @click="cutproject(1)"
        :class="currentIndex === 1 ? 'tab_active' : ''"
      >
        项目列表
      </div>
      <div
        class="tab_list_item"
        @click="cutproject(2)"
        :class="currentIndex === 2 ? 'tab_active' : ''"
      >
        项目分类
      </div>
    </div>
    <div>
      <projectlist
        ref="projectlist"
        v-show="this.currentIndex === 1"
      ></projectlist>
      <projectsort
        ref="projectsort"
        v-show="this.currentIndex === 2"
      ></projectsort>
    </div>
  </div>
</template>

<script>
import projectlist from "./projectlist.vue";
import projectsort from "./projectsort.vue";
export default {
  components: { projectlist, projectsort },
  name: "EryuoaStoreFrontendIndex",

  data() {
    return {
      currentIndex: 1,
    };
  },

  mounted() {},

  methods: {
    //  // 顶部tab切换
    cutproject(i) {
      this.currentIndex = i;
      if (i === 1) {
        this.$nextTick(() => {
        //   this.$refs.projectlist;
          console.log(this.$refs.projectlist);
        });
      }
    },
  },
};
</script>

<style lang="scss" scoped>
</style>